//
//  UIGLESSettingViewController.m
//  DrawColorPolygon
//
//  Created by 畑圭輔 on 10/03/07.
//  Copyright 2010 Keisuke Hata. All rights reserved.
//

#import "UIGLESSettingViewController.h"


@implementation UIGLESSettingViewController

@synthesize glView;

- (IBAction) selectedPolyStyle {
	
	glView.polyStyle = [_polyStyle selectedSegmentIndex];
	[glView updateAnimation];
	NSLog(@"Draw Triangle mode = %d" , glView.polyStyle );
}
	
- (IBAction) selectedLineStyle {
	
	glView.lineStyle = [_lineStyle selectedSegmentIndex];
	[glView updateAnimation];
	NSLog(@"Draw Line mode = %d" , glView.lineStyle );
}

- (IBAction) changedLineWidth {
	
	float value = _lineWidth.value;
	int iValue = value;
	if( iValue==0 ) 
		value = 1.0f;
	
	value = iValue;
	_lineWidth.value = value;
	[glView updateLineWidth:iValue];
}

- (IBAction) show {
	
	ControlView *view = (ControlView *)self.view;
	
	if( !_isOpened )
	{	
		[view open];
		_isOpened = YES;
		
	}else {
		[view close];
		_isOpened = NO;
		
	}
	NSLog(@"show view");
}

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}
*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	
	_isOpened = NO;
	
	NSLog(@"viewLoad!!");
	CGRect frame = self.view.frame;
	frame.origin.y = self.view.frame.size.height - 40;
	[self.view setFrame:frame];
    [super viewDidLoad];
}

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
